package com.cyw.search.entity.note;
import cn.easyes.annotation.HighLight;
import cn.easyes.annotation.IndexField;
import cn.easyes.annotation.IndexId;
import cn.easyes.annotation.IndexName;
import cn.easyes.common.constants.Analyzer;
import cn.easyes.common.enums.FieldType;
import cn.easyes.common.enums.IdType;
import cn.easyes.common.params.JoinField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Set;

/**
 * @Author: Chenyw
 * @Date: 2022/10/24/15:43
 */

@Data
@ApiModel("文章文档")
@IndexName(value = "note_document",shardsNum = 3,replicasNum = 2,childClass = NoteComment.class)
public class SearchNoteEntity implements Serializable {

    @ApiModelProperty("es_id")
    @IndexId(type = IdType.NONE)
    private String id;

    @ApiModelProperty("文档标题")
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD)
    private String title;

    @ApiModelProperty("文档内容")
    @HighLight(mappingField = "highlightContent")
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD)
    private String content;

    @ApiModelProperty("高亮内容")
    private String highlightContent;

    @ApiModelProperty("作者")
    @IndexField(fieldType = FieldType.KEYWORD)
    private String creator;

    @ApiModelProperty("作者ID")
    @IndexField(fieldType = FieldType.LONG)
    private Long userId;

    @ApiModelProperty("文档描述")
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD)
    private String description;

    @ApiModelProperty("创建时间")
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
    private String createTime;

    @ApiModelProperty("修改时间")
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
    private String updateTime;

    @ApiModelProperty("经纬度坐标:40.13933715136454,116.63441990026217")
    @IndexField(fieldType = FieldType.GEO_POINT)
    private String location;

    @ApiModelProperty("图形(例如圆心,矩形)")
    @IndexField(fieldType = FieldType.GEO_SHAPE)
    private String geoLocation;

    @ApiModelProperty("文档评论")
    @IndexField(fieldType = FieldType.JOIN, parentName = "note_document", childName = "note_comment")
    private JoinField joinField;

    @ApiModelProperty("文档标签")
    @IndexField(fieldType = FieldType.KEYWORD)
    private Set<String> tags;

    @ApiModelProperty("文档访问量")
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer views = 0;

    @ApiModelProperty("文档点赞量")
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer likeCount = 0;

    @ApiModelProperty("文档评论数")
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer commentCount = 0;

    @ApiModelProperty("文档类型名")
    @IndexField(fieldType = FieldType.KEYWORD)
    private String typeName;

    @ApiModelProperty("文档首图地址")
    @IndexField(fieldType = FieldType.KEYWORD)
    private String firstPicture;
}
